package org.example.orders.advice;

import org.example.orders.vo.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyControllerAdvice {

    @ExceptionHandler(Exception.class)
    public String doMyException(Exception e){
        //记录日志
        e.printStackTrace();
        //安抚用户
        return "统一异常处理了:"+e.getMessage();
    }
}


